$(document).ready(function () {
  $("form").on("submit", function (e) {
    e.preventDefault();
    $.ajax({
      url: "/login",
      method: "POST",
      data: $(this).serialize(),
      success: function (data) {
        if (data.status === "error") {
          window.alert(data.message);
        } else {
          window.location.href = "/";
        }
      },
    });
  });
});
